<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:php="http://php.net/xsl"
	exclude-result-prefixes="php"
	version="1.0">

	<!-- XHTML 1.0 Header -->
	<xsl:output method="xml" encoding="UTF-8" indent="no"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
		doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />

	<!-- Global Variables -->
	<xsl:include href="vars.xsl"/>

	<!-- Page Header -->
	<xsl:template name="header">
		<xsl:call-template name="add-html-lang"/>
		<head>
			<xsl:call-template name="page-title"/>
			<style type="text/css">@import url(/css/platcode.css);</style>
			<xsl:text disable-output-escaping="yes"><![CDATA[<!--[if IE]><style type="text/css">@import url(/css/ie-all.css);</style><![endif]-->]]></xsl:text>
			<script type="text/javascript" src="/js/jdog.js"></script>
			<xsl:apply-templates select="//import-js"/>
			<xsl:apply-templates select="//openid-delegate"/>
		</head>
	</xsl:template>

	<!-- Page Title -->
	<xsl:template name="page-title">
		<title>
			<xsl:value-of select="php:function('config','app_name')"/>
			<xsl:apply-templates select="//page-title"/>
		</title>
		<base href="{$base-url}"/>
	</xsl:template>

	<!-- Page Title Suffix -->
	<xsl:template match="//page-title">
		<xsl:text> - </xsl:text>
		<xsl:value-of select="."/>
	</xsl:template>

	<!-- JavaScript import -->
	<xsl:template match="//import-js">
		<xsl:for-each select="item">
			<script type="text/javascript" src="/js/{.}.js"></script>
		</xsl:for-each>
	</xsl:template>

	<!-- OpenID Delegate-->
	<xsl:template match="//openid-delegate">
		<link rel="openid2.provider openid.server" href="{$base-url}OpenIDServer"/>
		<link rel="openid2.local_id openid.delegate" href="{$base-url}OpenIDDelegate/{.}"/>
	</xsl:template>

	<!-- HTML tag attributes -->
	<xsl:template name="add-html-lang">
		<xsl:attribute name="lang">
			<xsl:value-of select="php:function('config','language')"/>
		</xsl:attribute>
	</xsl:template>

	<!-- Session Bar -->
	<xsl:template name="session-bar">
		<li>
			<a href="/{$session-name}" class="home">
				<xsl:value-of select="$session-name"/>
				<xsl:text>@</xsl:text>
				<xsl:value-of select="php:function('lang','home')"/>
			</a>
		</li>
		<li class="right">
			<a href="/account/logout" onclick="return acceptContinue()">
				<xsl:value-of select="php:function('lang','account_exit')"/>
			</a>
		</li>
		<li class="right">
			<a href="/account/settings">
				<xsl:value-of select="php:function('lang','settings')"/>
			</a>
		</li>
	</xsl:template>

</xsl:stylesheet>
